package com.flappySeeker.controller;

import java.io.File;

public class Constants {
	
	public final static String RESPATH="/xstory/";
	private static String XSTORY_PATH="";
	private static String BASE_PATH="";
	public final static String xstory_type=".htm";
	public final static String ENCODING_UTF8="utf-8";
	/**
	 * 获得生成模板文件的文件夹路径
	 * @return
	 */
	public static String getXSTORY_PATH() {
		if(XSTORY_PATH.isEmpty()){
			File root = new File(getBasepath()+"/"+RESPATH);
			XSTORY_PATH=root.getAbsolutePath()+"/";
		}
		return XSTORY_PATH;
	}
	
	/**
	 * 获得项目 基本路径 绝对地址
	 * @return
	 */
	public static String getBasepath() {
		if(BASE_PATH.isEmpty()){
			String s = Constants.class.getClassLoader().getResource("").toString();
			File f = new File(s.substring(s.indexOf("/"))).getParentFile().getParentFile();
			BASE_PATH=f.getAbsolutePath();
		}
		return BASE_PATH;
	}

	

}
